package com.knowledge.plus.设计模式.建造者模式.impl;

import com.knowledge.plus.设计模式.建造者模式.Builder;
import com.knowledge.plus.设计模式.建造者模式.Building;

/**
 * 公寓施工队
 *
 * @author TPF
 * @since 2023/12/12
 */
public class ApartmentBuilder implements Builder {
    private Building apartment;

    public ApartmentBuilder() {
        apartment = new Building();
    }

    /**
     * 施工三步曲
     */
    @Override
    public void buildBasement() {
        System.out.println("建造地基");
        apartment.setBasement("╚═════════╝\n");
    }

    @Override
    public void buildWall() {
        System.out.println("建造墙体");
        for (int i = 0; i < 8; i++) {// 8层
            apartment.setWall("║ □ □ □ □ ║\n");
        }
    }

    @Override
    public void buildRoof() {
        System.out.println("建造屋顶");
        apartment.setRoof("╔═════════╗\n");
    }

    @Override
    public Building getBuilding() {
        return apartment;
    }
}